Data Types

Data types are defined within the common elements of IECClosed "International Electrotechnical Commission" IEC is a not-for-profit, non-governmental international standards organization that prepares and publishes International Standards for all electrical, electronic and related technologies 61131-3.

Why Data typing?

Data typing is implemented to define the type of any parameter used, which helps to prevent errors early on in the programming phase. This avoids for example dividing a Date by an Integer.

When you have defined whether the data is a string, a date, an integer or a 16-bit Boolean input, there is no longer any confusion, nor any conflict between different people using the textual representation (i.e. the name of the variable).

Different kinds of Data types

Common data types are Boolean, Integer, Real, Byte, Word, Date, Time_of_Day, and String. Based on these, you can define your own personal data types, known as derived data types. In this way you can define an analog input channel as a data type, and re-use it.

List of Data types

Below are the available basic data types:

Types Description Values Prefixes
BOOL Boolean (bit) FALSE or TRUE - stored in 1 byte  
SINT Small signed integer in 8 bits -128 to +127 SINT#
USINT Small unsigned integer in 8 bits 0 to +255 USINT#
BYTE Same as USINT    
INT Signed integer in 16 bits -32768 to +32767 INT#
UINT Unsigned integer in 16 bits 0 to +65535 UINT#
WORD Same as UINT    
DINT Signed double precision integer in 32 bits -2147483648 to +2147483647  
UDINT Unsigned integer in 32 bits 0 to +4294967295 UDINT#
DWORD Same as UDINT    
LINT Long signed integer in 64 bits   LINT#
ULINT Long unsigned integer in 64 bits   ULINT#
LWORD Same as ULINT    
REAL Single precision floating point stored in 32 bits -3.4E38 to 3.4E38 and -3.4E-38 to 3.4E-38 (6 to 7 significant digits of accuracy) LREAL# ‡‡
LREAL Double precision floating point stored in 64 bits -1.7E308 to 1.7E308 and -1.7E-308 to 1.7E-308 (14 to 15 significant digits of accuracy) LREAL#
TIME Time data type is used to specify a time variable - accuracy is 1ms. See TIME for more information. 0ms to 24h T# or TIME#
STRING Variable length string with declared maximum length
Each character is store on 1 byte (i.e. on 8 bits)
Maximum length cannot exceed 255 characters  

  • REAL variables are limited to 6 digits of accuracy. To achieve greater accuracy, a longer mantissa may be specified by prefixing LREAL with #.

    Example: To achieve an accuracy of 20 digits for the value of pi, rather than what REAL provides (3.14159), set the type to LREAL#3.141592653589793238.


  • ‡‡ REAL is restrictive, but because it is the default, it is recommended to explicitly declare your real constants with the LREAL# prefix.


  • You can use 2#,8# or 16# prefixes to specify an integer in binary, octal or hexadecimal basis respectively.